package com.softeem.hbsmvideo.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.softeem.hbsmvideo.entity.Category;
import com.softeem.hbsmvideo.entity.Video;
import com.softeem.hbsmvideo.service.CategoryService;
import com.softeem.hbsmvideo.service.VideoService;
import com.softeem.hbsmvideo.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/*
* 分类的业务接口
* */
@RequestMapping("/category")
@RestController
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping("/list")
    public R list(@RequestParam(defaultValue = "1")Integer page, @RequestParam(defaultValue = "5") Integer limit){
        List<Category> list = categoryService.list(new Page<Category>(page, limit));
        Long count=categoryService.count();
        return R.ok("查询成功").setData(list).setCount(count);

    }
}
